﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ChangeProblem.Logic
{
    
   public class ChangeProblemDemo
    {
        /// <summary>
        /// Calculated the balance
        /// </summary>
        public  decimal  GetMoney(decimal pay,decimal cost) {
            decimal balance;
            balance = pay - cost;
            if (balance >= 0)
                return balance;
            else
                return -1;
        }
      
        /// <summary>
        /// Show your payment
        /// </summary>
        public   int[] ReturnCondition(decimal balance,decimal[] currency,int[] quanity) {

            for (int i = 0;balance != 0; i++) {
                quanity[i] = (int)(balance / currency[i]);
                balance = balance % currency[i];
            }
            return quanity;  
        }


    }
}
